#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	double price=0.0;
	int month=0, day=0,k=0;
	scanf("%lf %d %d %d", &price, &month, &day, &k);
	     if (month == 11 && day == 11)
	     {	
			 price= price * 0.7 - 50.0 * k;
	     }
    else if (month == 12 && day == 12)
		 {
			 price= price * 0.8 - 50.0*k;
		 }
		 if (price < 0)
		 {
			 printf("0.00\n");
		 }
		 else
		 {
			 printf("%.2lf\n", price);
		 }

	return 0;
}